package realQuestion.jiezi;

import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count=scanner.nextInt();

        for (int i = 0; i < count; i++) {
            int n=scanner.nextInt();
            System.out.println(find(n));
        }

    }
    public  static  int find(int n){

        int count=0;
        for (int i = 1; i <= n / 3; i++) {
            for (int j = 1; j <=n/3 ; j++) {
                int k=n/3-i-j;
                if (i*3+j*3+k*3==n&&k>0){
                    count++;
                }
            }
        }

        return  count;



    }



}
